Repository navigation
feat(docs-site): build the model explorer in Java and Kotlin without Node - #671
Merged
Merged
Conversation
…nd Python manifests
After a write run, the hash manifest entry of a per-object file now names its
generator and the node's resolution key ({hash, generatedBy, sourceNode}, after
the JVM's generator/outputDir), as TypeScript already did, so a docs view built
from any of these ports lists each node's generated files. A whole-model file
keeps the plain hash. A shared 'provenance' vector in
fixtures/codegen-skip-conformance/manifests.json holds TypeScript, C#, Java and
Python to the same entries.
…ated on branch; one wording fix.
…VM, with no Node The JVM builds the port-neutral docs view from its loaded model (DocsView), byte for byte what TypeScript builds for every fixtures/explorer-conformance case, gated in the metadata suite. A docs-site generator (DocsSiteGenerator, registered in the Java and Kotlin registries, eject-exempt like TypeScript's) writes explorer.json, the shared explorer app, explorer-model.js and explorer-stamp.js, and lists each node's generated files from the hash manifest's provenance. Kotlin runs the same class, and its suite gates every corpus case through its own registry. MetaEndpoint gains the /_meta/docs helpers (body, ETag, If-None-Match), mounted by the host as /_meta is. Needs the HashManifest.loadProvenance API from #669.
…fm/mo-130-docs-view-jvm # Conflicts: # docs/features/explorer-site.md
…h dry-run cargo publish --workspace unpacks its overlay-registry dependencies into a per-checkout directory and never re-unpacks while the version is unchanged, so the self-hosted runner verified metaobjects-codegen against a metaobjects-1.3.0 unpacked before metamodel_docs existed. Main has been red on the rust lane since #670 for this reason; the crate itself packages correctly.
…t, and hold docs-site to the inert line The model and stamp scripts move beside the docs view serializer (com.metaobjects.docsview.ExplorerModelScript), so codegen-base types no line breaks (LayoutRatchetTest). The codegen-noop inert tests hold docs-site to the line TypeScript's rules-inert test draws: the explorer documents every node, so only its data payload may differ, and only by the new nodes and members.
…uild explorer.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #669
This PR supersedes #669, which could not go green on its own while main's Rust check was red, and carries its generated-file provenance work. It also fixes that Rust check: the publish dry-run verified
metaobjects-codegenagainst a stale unpackedmetaobjects-1.3.0that cargo reuses for an unchanged version, so the gate now clears stale unpacked copies of the workspace's own crates first (scripts/rust-clear-stale-publish-sources.sh).#669's summary:
generatedByandsourceNodeinto each per-object hash manifest entry, matching the TypeScript format. Files rendered from the whole model or a package keep the plain hash. The sharedprovenancevector infixtures/codegen-skip-conformance/manifests.jsonchecks all four ports against the same entries, and new per-port tests cover it.genrewrites the committed.metaobjects/.gen-state/.hashes/files once; generated source files do not change.explorer-app/assets/explorer-app.js) is minified without renaming identifiers, so unchanged sources build identical bytes. Every port's copy and the docs-site copy are refreshed. Also updates the explorer and own-your-codegen docs and ADR-0064 wording.Validated in one no-mistakes run (three review fix rounds; the Test step was approved as an exception, recorded below).
What Changed
docs-sitegenerator (DocsSiteGenerator, registered in both registries). It builds the port-neutral docs view in memory from the loaded model (DocsView,DocsViewJson,ExplorerModelScript,ExplorerSite) and writesexplorer.json, the shared explorer app,explorer-model.jsandexplorer-stamp.js, with no Node. The output matches TypeScript byte for byte onfixtures/explorer-conformance/. The running app can also serve the view at{apiPrefix}/_meta/docs(MetaEndpoint.docs). The static export and classic site remain TypeScript-only.{ "hash", "generatedBy", "sourceNode" }, matching TypeScript. A docs view built from these manifests fills the explorer's generated-files panel. Whole-model and package-level files keep the plain hash. The sharedprovenancevector infixtures/codegen-skip-conformance/manifests.jsonholds all four ports to the same entries. Upgrade note: the firstgenafter this rewrites the committed.hashes/files once. Generated source does not change.scripts/rust-clear-stale-publish-sources.sh, which removes stale unpacked copies of the workspace's own crates. This fixes the red Rust packaging check (could not find metamodel_docs).Pipeline notes
changelog.d/:explorer-jvm,generated-file-provenance-all-ports,explorer-app-stable-bundle,rust-publish-stale-sources.docs/features/explorer-site.md,explorer-data.md,metadata-api.md,docs-view.md,own-your-codegen.md,docs/CONFORMANCE.md,docs/ports/java.md,docs/ports/kotlin.md, and ADR-0064.Validation
Risk Assessment
✅ Low: The round-3 fix adds one key-set equality check to fingerprintMatches. The check can only turn a skip into a run, never the reverse. finishWholeRun already stores exactly the manifest's keys as outputs, so an unchanged build still skips. The new DocsSiteSkipTest covers the skip, settle and sibling-removal sequences: the removal case would have skipped before the fix and now runs. The rest of the branch is mechanical provenance stamping and additive JVM docs-view code, and prior rounds reviewed it.
Testing
Baseline ci-local affected run passed. I ran the focused JVM tests covering docs-site generation, generated-file provenance, the explorer site and the docs-view conformance corpus; all pass. These are unit and integration tests run through Maven, not a live run of the Maven plugin or CLI on a fixture project, so per the live rule they are recorded as not live. A live scenario for a Java or Kotlin project building explorer.json with no Node was not driven, so the verdict is inconclusive, not go. Logs are in the evidence directory.
mvn metaobjects:generaterun offline and output inspected. Tried to assess feasibility; the plugin install woul…Evidence: Maven log: DocsSiteSkipTest, GeneratedProvenanceTest, KotlinDocsSiteConformanceTest
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
server/java/codegen-base/src/main/java/com/metaobjects/generator/DocsSiteGenerator.java:91- The JVM docs-site generator lists generated files from the hash manifest on disk (manifest(genState)).MetaDataGeneratorMojosaves that manifest only after every generator has run (run.flush(), MetaDataGeneratorMojo.java:190). So in a write run the explorer is built from the PREVIOUS run's provenance.metaobjects:verifythen does a full in-memory render (beginCaptureRun, MetaDataVerifyMojo.java:631) against the manifest that the write run has just saved, so its explorer differs from the committed one. Here is a concrete case: a project addsdocs-siteand upgrades to this build. Run 1 reads a manifest that has nogeneratedBy/sourceNodeyet (or no manifest, sosources.files:false). It writes explorer.json with empty file lists and then saves provenance for every per-object file. In CI, where the gitignored fingerprint is absent,mvn metaobjects:verifyrenders explorer.json, explorer-model.js and explorer-stamp.js with the file lists filled, and reports drift. Adding or renaming an entity has the same effect. Runninggenerateagain does not repair it, because ADR-0064 skips an unchanged run. The manifest is deliberately not inextraInputs()(DocsSiteGenerator.java:68-70, whose rationale 'that run regenerates anyway' misses that the regeneration reads the pre-save manifest), so the user needs-Dmetaobjects.force=true. Kotlin hits the same flip on its first run, when there is no manifest at docs-site time but one exists at verify time. TypeScript avoids this becauserunDocsViewbuilds from the run's own output (ctx.runOutput). Recommended fix: build the docs view's files input from the activeGeneratedFileWriter.Runprovenance. That is the map loaded from disk plus this run's records, and it needs an accessor. Give the capture run the same loaded-and-recorded provenance, so generate and verify see the same input. The sentence 'they show the files the previous write run recorded' (docs/features/explorer-site.md:94, docs/ports/java.md:472 'as of the last write run') would then need updating.server/java/metadata/src/main/java/com/metaobjects/io/json/MetaEndpoint.java:80- Simplification: the JVMGET {apiPrefix}/_meta/docshelper (META_DOCS_ROUTE_PATH,metaDocsJson,docs(root), theDocsETag holder,metaDocsEtag,etagMatches, plus MetaDocsEndpointTest, the metadata-ktx test and the Spring controller example in docs/features/metadata-api.md) is a runtime serving surface. The stated Option 4 is to build the docs view, write explorer.json and copy the app, so that a Java/Kotlin project gets the explorer with no Node. The route is not needed for that. The captain's 'pull it all into 1.3.0' may cover it. If it does not, remove the component and keep it for a later change.docs/CONFORMANCE.md:919- Changed 'One port runs it: TypeScript, in' to 'TypeScript runs it in'. The paragraph just above now says Java and Kotlin build every explorer-conformance case.docs/features/explorer-data.md:161- The 'Not built yet' entry still said only TypeScript builds the docs view. Reworded it to 'The docs view in C#, Python and Rust. TypeScript, Java and Kotlin build it today'.docs/features/explorer-site.md:91- The JVM section said no node lists REST routes, but DocsSiteGenerator accepts aroutesFilearg. Added 'unless you name them inroutesFile([{ node, method, path }],nodea resolution key)'.docs/ports/java.md:472- Added the missingroutesFilearg to thedocs-siterow's argument list. DocsSiteGenerator.ARG_ROUTES_FILE exists, and the Java/Kotlin conformance tests pass it.🔧 Fix applied.
7 issues (2 warnings, 5 infos) still open:
server/java/metadata/src/main/java/com/metaobjects/io/json/MetaEndpoint.java:80- Simplification: the JVMGET {apiPrefix}/_meta/docshelper (META_DOCS_ROUTE_PATH,metaDocsJson,docs(root), theDocsETag holder,metaDocsEtag,etagMatches, plus MetaDocsEndpointTest, the metadata-ktx test and the Spring controller example in docs/features/metadata-api.md) is a runtime serving surface. The stated Option 4 is to build the docs view, write explorer.json and copy the app, so that a Java/Kotlin project gets the explorer with no Node. The route is not needed for that. The captain's 'pull it all into 1.3.0' may cover it. If it does not, remove the component and keep it for a later change.docs/CONFORMANCE.md:919- Changed 'One port runs it: TypeScript, in' to 'TypeScript runs it in'. The paragraph just above now says Java and Kotlin build every explorer-conformance case.docs/features/explorer-data.md:161- The 'Not built yet' entry still said only TypeScript builds the docs view. Reworded it to 'The docs view in C#, Python and Rust. TypeScript, Java and Kotlin build it today'.docs/features/explorer-site.md:91- The JVM section said no node lists REST routes, but DocsSiteGenerator accepts aroutesFilearg. Added 'unless you name them inroutesFile([{ node, method, path }],nodea resolution key)'.docs/ports/java.md:472- Added the missingroutesFilearg to thedocs-siterow's argument list. DocsSiteGenerator.ARG_ROUTES_FILE exists, and the Java/Kotlin conformance tests pass it.server/java/codegen-base/src/main/java/com/metaobjects/generator/util/GeneratedFileWriter.java:177- Round 1's fix for docs-site-stale-manifest-verify-drift introduced this regression. The fix made the docs site list onlyRun.generatedFiles(), which holds this execution's ownrecord()calls. The committed manifest is merged in only whenmeta.entitiesnarrows the run (MetaDataGeneratorMojo.java:158). The plugin supports several<execution>s that share one manifest in a module (MetaDataGeneratorMojo.java:131-135: 'two executions in one module share it (merged)'; 'a sibling <execution> sharing the manifest'). Concrete sequence: execution A runs the entity, DTO and controller generators at generate-sources and flushes their provenance. Execution B runsdocs-sitealone in a later phase. Its run callsconfigureManifest, soprojectRootis set andgeneratedFiles()returns an empty map that is not null.DocsViewthen writessources.files: trueand an empty file list for every object. The round-1 code listed A's files correctly in this setup.metaobjects:verify@Brenders the same empty lists, so no gate catches the wrong output. The new docs carry the same claim: explorer-site.md:92-94 and java.md:472 say 'the run builds the site after every other generator', which holds only within one execution. Fix: build the list from this run's records plus every committed-manifest entry whose owner is not one of this execution's owners (the orphan sweep'srunOwnersrule). Apply the same rule inMetaDataVerifyMojo.renderInMemoryby loading the manifest's provenance and owners into the capture run. Then generate and verify still see the same input. Reword the two doc sentences to say 'this execution'.docs/features/explorer-site.md:74- After the fix round, the Java row of the 'In each port' table still said the explorer reads 'the files the committed hash manifest records per node'. Changed it to 'the files the same run generated per node', which matches the prose below the table and the java.md row.🔧 Fix applied.
7 issues (2 warnings, 5 infos) still open:
server/java/metadata/src/main/java/com/metaobjects/io/json/MetaEndpoint.java:80- Simplification: the JVMGET {apiPrefix}/_meta/docshelper (META_DOCS_ROUTE_PATH,metaDocsJson,docs(root), theDocsETag holder,metaDocsEtag,etagMatches, plus MetaDocsEndpointTest, the metadata-ktx test and the Spring controller example in docs/features/metadata-api.md) is a runtime serving surface. The stated Option 4 is to build the docs view, write explorer.json and copy the app, so that a Java/Kotlin project gets the explorer with no Node. The route is not needed for that. The captain's 'pull it all into 1.3.0' may cover it. If it does not, remove the component and keep it for a later change.docs/CONFORMANCE.md:919- Changed 'One port runs it: TypeScript, in' to 'TypeScript runs it in'. The paragraph just above now says Java and Kotlin build every explorer-conformance case.docs/features/explorer-data.md:161- The 'Not built yet' entry still said only TypeScript builds the docs view. Reworded it to 'The docs view in C#, Python and Rust. TypeScript, Java and Kotlin build it today'.docs/features/explorer-site.md:91- The JVM section said no node lists REST routes, but DocsSiteGenerator accepts aroutesFilearg. Added 'unless you name them inroutesFile([{ node, method, path }],nodea resolution key)'.docs/ports/java.md:472- Added the missingroutesFilearg to thedocs-siterow's argument list. DocsSiteGenerator.ARG_ROUTES_FILE exists, and the Java/Kotlin conformance tests pass it.docs/features/explorer-site.md:74- After the fix round, the Java row of the 'In each port' table still said the explorer reads 'the files the committed hash manifest records per node'. Changed it to 'the files the same run generated per node', which matches the prose below the table and the java.md row.server/java/maven-plugin/src/main/java/com/metaobjects/mojo/AbstractMetaDataMojo.java:639- Round 2's fix (docs-site-run-output-drops-sibling-execution-files) made the JVM docs site list the committed files of the module's OTHER executions (committedFilesBeside, AbstractMetaDataMojo.java:851). The ADR-0064 whole-run skip does not track those files, so the site can go stale with no input change. Concrete sequence: execution A runs entity, DTO and controller generators at generate-sources. Execution B runsdocs-sitealone later, with the case the round-2 testaDocsSiteExecutionOfItsOwnListsTheFilesAnotherExecutionGeneratedcovers. The user removes the controller generator from A. A runs, sweeps the controller files and drops their manifest entries. B's per-execution fingerprint (fingerprintOwnerTag) is unchanged: same model, same B config, sameextraInputs().fingerprintMatchesiterates only the CURRENT manifest's entries (line 639) and checks each againststored.outputs(). A key that DISAPPEARED from the manifest is never noticed. B skips, so explorer.json, explorer-model.js and explorer-stamp.js still list the deleted controller files. A localverifyanswers no drift from the fingerprint. CI (fingerprint gitignored) runsrenderInMemory, which carries the swept manifest and reports drift. A plaingeneratedoes not repair it, and the user needs-Dmetaobjects.force=true. Additions and content changes in A are caught, because a new key or hash has no matching stored output. Only removals leak. The same blind spot leaves the comment at DocsSiteGenerator.java:72-73 wrong. It says 'the files the site lists are the ones this run generates, which follow from the model and these inputs', but since round 2 the site also lists other executions' files, which follow from neither. Smallest fix: infingerprintMatches, also return false whenstored.get().outputs().keySet()differs from the current manifest's key set, so additions and removals are handled the same way. Then correct the DocsSiteGenerator comment. Sibling:fingerprintAnswersNoDriftgoes through the samefingerprintMatches, so the one fix covers both generate and local verify.🔧 Fix applied.
6 issues (1 warning, 5 infos) still open:
server/java/metadata/src/main/java/com/metaobjects/io/json/MetaEndpoint.java:80- Simplification: the JVMGET {apiPrefix}/_meta/docshelper (META_DOCS_ROUTE_PATH,metaDocsJson,docs(root), theDocsETag holder,metaDocsEtag,etagMatches, plus MetaDocsEndpointTest, the metadata-ktx test and the Spring controller example in docs/features/metadata-api.md) is a runtime serving surface. The stated Option 4 is to build the docs view, write explorer.json and copy the app, so that a Java/Kotlin project gets the explorer with no Node. The route is not needed for that. The captain's 'pull it all into 1.3.0' may cover it. If it does not, remove the component and keep it for a later change.docs/CONFORMANCE.md:919- Changed 'One port runs it: TypeScript, in' to 'TypeScript runs it in'. The paragraph just above now says Java and Kotlin build every explorer-conformance case.docs/features/explorer-data.md:161- The 'Not built yet' entry still said only TypeScript builds the docs view. Reworded it to 'The docs view in C#, Python and Rust. TypeScript, Java and Kotlin build it today'.docs/features/explorer-site.md:91- The JVM section said no node lists REST routes, but DocsSiteGenerator accepts aroutesFilearg. Added 'unless you name them inroutesFile([{ node, method, path }],nodea resolution key)'.docs/ports/java.md:472- Added the missingroutesFilearg to thedocs-siterow's argument list. DocsSiteGenerator.ARG_ROUTES_FILE exists, and the Java/Kotlin conformance tests pass it.docs/features/explorer-site.md:74- After the fix round, the Java row of the 'In each port' table still said the explorer reads 'the files the committed hash manifest records per node'. Changed it to 'the files the same run generated per node', which matches the prose below the table and the java.md row.server/java/maven-plugin- No live end-to-end run: the Java/Kotlin docs-site path (metaobjects:generatewith a docs-site entry, thenexplorer.jsonand the copied app with no Node) was not driven against a fixture project. Evidence is focused tests only. Needs a disposable fixture run of the Maven plugin to confirm the explorer output and the stale-manifest fixes (rounds 1-4) hold live.mvn metaobjects:generaterun offline and output inspected. Tried to assess feasibility; the plugin install woul…scripts/ci-local.sh --affected --strict-toolchainsbaseline:scripts/ci-local.sh --affected --strict-toolchains(passed at target commit, per run context)mvn -o -q -pl maven-plugin -am test -Dtest=DocsSiteSkipTest,GeneratedProvenanceTest(run from server/java): DocsSiteSkipTest 3/3, GeneratedProvenanceTest 5/5, KotlinDocsSiteConformanceTest 1/1 passmvn -o -q -pl codegen-base,metadata -am test -Dtest=ExplorerSiteTest,DocsViewConformanceTest(run from server/java): ExplorerSiteTest 7/7, DocsViewConformanceTest 3/3 pass✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.